﻿@model List<HANS_BackStage.Model.WebModel.MenuItem>
@using HANS.Utility.Extensions;
<div id="sidebar-menu" class="main_menu_side hidden-print main_menu">
    <div class="menu_section active">
        <h3 class="h3"><a href="@Url.Action("Index","Home")"><i class="fa fa-home fa-2x" style="color:#9AFF9A"></i>HANS-HOME</a></h3>
        <ul class="nav side-menu" style="">
            @foreach (var menuItem in Model)
            {
                <li class="@(menuItem.IsActive ? "current-page" : "")">@*@(menuItem.IsActive ? "active open" : "")*@
                    @{
                        string url = (menuItem.Action.IsNullOrWhiteSpace() || menuItem.Controller.IsNullOrWhiteSpace())
                                        ? "javascript:void(0)" : Url.Action(menuItem.Action, menuItem.Controller,new { area=menuItem.Area});//"javascript:void(0)"; 
                        if (url.Equals("javascript:void(0)") &&menuItem.Url.IsNotNullAndNotWhiteSpace())
                        {
                            url = menuItem.Url;
                        }
                    }
                    <a  href="@url">
                        <i class="fa @(menuItem.Css.IsNotNullAndNotWhiteSpace()?menuItem.Css:"fa-slack")"></i> @menuItem.MenuItemName
                        @if (menuItem.ChildrensMenuItem.Any())
                        {
                            <span class="fa fa-chevron-down"></span>
                        }
                    </a>
                    @if (menuItem.ChildrensMenuItem.Any())
                    {
                        <ul class="nav child_menu" style="display: none;">
                            @foreach (var item in menuItem.ChildrensMenuItem)
                            {
                                @Html.Partial("_MenuItem", item)
                            }
                        </ul> 
                    }
                </li>
                        }
        </ul>
    </div>
    
 </div>

